<template>
	<view class="wrap">
		<!-- 轮播图 -->
		<u-swiper :list="swiperList" keyName="image" showTitle :autoplay="false" circular @click="clickBannerItem(e)">
		</u-swiper>

		<!-- 宫格组件 -->
		<uni-section title="客户管理" type="line"></uni-section>
		<view>
			<u-grid :border="false" col="4">
				<u-grid-item v-for="(item,index) in menuList" :key="index" @click="routerTo(item.href)">
					<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="22" color="#2979ff"></u-icon>
					<text class="grid-text">{{item.title}}</text>
				</u-grid-item>
			</u-grid>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				current: 0,
				swiperDotIndex: 0,
				swiperList: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],
				menuList: [{
						icon: 'list-dot',
						title: '客户信息',
						href: '/pages/crm/customer/index'
					},
					{
						icon: 'plus-people-fill',
						title: '新增客户',
						href: '/pages/crm/customer/new'
					},
					{
						icon: 'map',
						title: '周边客户',
						href: '/pages/crm/index/index'
					},
				]
			}
		},
		methods: {
			clickBannerItem(item) {
				console.info(item);
			},
			changeSwiper(e) {
				this.current = e.detail.current
			},
			routerTo(href) {
				uni.navigateTo({
					url: href
				});
			}
		}
	}
</script>

<style lang="scss">
	.wrap {
		padding: 6rpx;
	}
</style>
